function template(id, data) {
    var str = document.getElementById(id).innerHTML;
    var patten = /{{\s*([a-zA-Z]+)\s*}}/;
    var pattResult = null;
    while (pattResult = patten.exec(str)) {
        str = str.replace(pattResult[0], data[pattResult[1]]);
    }
    return str;
}